float4x4 World;
float4x4 View;
float4x4 Projection;

//Texture colorTexture;
Texture textureOrigin;
Texture textureDestiny;
float time;

sampler textureOriginSampler = sampler_state 
{
	texture = <textureOrigin>;
	magfilter = LINEAR;
	minfilter = LINEAR;
	mipfilter = LINEAR;
	AddressU = clamp;
	AddressV = clamp;
};
sampler textureDestinySampler = sampler_state 
{
	texture = <textureDestiny>;
	magfilter = LINEAR;
	minfilter = LINEAR;
	mipfilter = LINEAR;
	AddressU = clamp;
	AddressV = clamp;
};



// TODO: add effect parameters here.



struct VertexShaderInput
{
    float4 Position : POSITION0;
	float2 Texture : TEXCOORD0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
	float2 Texture : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

	output.Texture = input.Texture;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{

	float4 origin = tex2D(textureOriginSampler, input.Texture);
	float4 destiny = tex2D(textureDestinySampler, input.Texture);
	float4 output = origin * (1 - time) + destiny * time;


	return output; 
}



//CRIANDO NOVO SHADER

/*float4 PixelShaderGrayscaleFunction(VertexShaderOutput input) : COLOR0
{
	float4 output;
//	output = tex2D(colorTextureSampler, input.textureCoord);
	return dot(output, float3(0.3, 0.59, 0.11)); 
}

float4 PixelShaderInverseFunction(VertexShaderOutput input) : COLOR0
{
	float4 output;
	//output = 1 - tex2D(colorTextureSampler, input.textureCoord);
	return output;
}

/*float4 PixelShaderBlurFunction(VertexShaderOutput input) : COLOR0
{
	float4 output;
	//output =  tex2D(colorTextureSampler, input.textureCoord);
	//output +=  tex2D(colorTextureSampler, input.textureCoord + 0.01);
	//output +=  tex2D(colorTextureSampler, input.textureCoord - 0.01);
	//output /= 3;
	//return output;
}*/

technique TechniqueNormal
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
		
    }
}


//CRIANDO NOVA TECNICA

/*technique TechniqueGrayscale
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderGrayscaleFunction();
		
    }
}

technique TechniqueInverse
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderInverseFunction();
		
    }
}

/*technique TechniqueBlur
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderBlurFunction();
		
    }
}
*/